#include "widget.h"
#include "ui_widget.h"
#include<QIcon>
#include<QPainter>
#include<QPixmap>
#include<QPushButton>
#include<QFont>
#include"check.h"
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->setWindowIcon(QIcon(":/res/ico.png"));
    this->setWindowTitle("游戏大厅");
    this->setFixedSize(800,600);

    QPushButton *start=new QPushButton(this);
    start->move(380,400);
    QFont font("微软雅黑",26);
    start->setFont(font);
    start->setText("开始游戏");
    start->setStyleSheet("QPushButton {border: 0 px  ; }");

    connect(start,&QPushButton::clicked,this,[=](){
        check * check_window=new check;
        check_window->show();
        this->close();
    });

}

Widget::~Widget()
{
    delete ui;
}

//重写事件，本质是在重写时间处理函数

void Widget::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    QPixmap back_ground(":/res/game_hall.png");
    painter.drawPixmap(0,0,800,600,back_ground);
}

